﻿/*
 ***************************************************************************
 * Microsoft Visual C# .NET
 * 名称：       App_System_HealthWorkPart
 * 类型：       控制层

 * 功能说明：   健康工作区显示
 *              
 * 作者：       谈震鸣
 * 创建日期：   2007/12/13
 * 修改日期     修改者      修改内容
 * 
 * 
 * ---
 ***************************************************************************
*/
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Shpm.App.Main.Bean;
using Shpm.App.Main.Dao;
using Shpm.System;
using Shpm.App.Commons.Db.Beans.Master;
using Shpm.App.Commons.Utils;
using Com.CodeProject.Pop3;
using Shpm.App.Input.Dao;
using Shpm.App.Commons.Db.Beans.Inp;
using Shpm.App.Input.Bean;

public partial class App_System_HealthWorkPart : System.Web.UI.UserControl
{
    protected string userId = string.Empty;
    protected string strEmployeeId=string.Empty;
    protected string strJobId = string.Empty;
    private const string JOB_ID_DOCTOR = "34";//保健医生职位编号
    protected void Page_Load(object sender, EventArgs e)
    {
        // 查询销售过程

        SysUserManager manager = new SysUserManager(Context);
        SysUserBean sysUserBean = manager.getSysUserBean();
        if (sysUserBean != null)
        {
            MstEmployeeBean empBean = sysUserBean.getEmployeeBean();
            MstSysUserBean mstSysUserBean =
                sysUserBean == null ? null : sysUserBean.getMstSysUserBean();
            if (mstSysUserBean != null)
            {
                this.userId = mstSysUserBean == null ? "" : mstSysUserBean.SysUserId;
            }
            if (empBean != null)
            {
                strEmployeeId = empBean.EmployeeId;
                IList dataList = null;
                //查找JOB_ID

                PersonEmployeeDao personEmployeeDao = new PersonEmployeeDao();
                PersonEmployeeBean personEmployeeBean = new PersonEmployeeBean();
                personEmployeeBean.EmployeeId = empBean.EmployeeId;
                personEmployeeBean = personEmployeeDao.Find(personEmployeeBean);
                strJobId = Convert.ToString(personEmployeeBean.JobId);
            }
        }

        if (strJobId!=string.Empty)
        {
            if (strJobId.Equals(JOB_ID_DOCTOR))
            {
                HealthAssignBean dataBean = new HealthAssignBean();
                HealthAssignDao Dao = new HealthAssignDao();
                dataBean.DoctorId = strEmployeeId;
                IList dataList = Dao.FindByMenberHave(dataBean);
                for (int i = 10; dataList.Count > 10;i++ )
                {
                    dataList.RemoveAt(10);
                }
                Repeater1.DataSource = dataList;
                Repeater1.DataBind();
                
                Repeater2.Visible = false;
            }
            else
            {
                HappyChamberlaineBean dataBean = new HappyChamberlaineBean();
                HappyChamberlaineSrhDao Dao = new HappyChamberlaineSrhDao();
                dataBean.EmployeeId = strEmployeeId;
                IList dataList = Dao.FindByMenberHave(dataBean);
                for (int i = 10; dataList.Count > 10; i++)
                {
                    dataList.RemoveAt(10);
                }
                Repeater2.DataSource = dataList;
                Repeater2.DataBind();
                Repeater1.Visible = false;
            }
        }
    }
    protected void LinkButton_Command(object sender, CommandEventArgs e)
    {
        // 传递控件参数
        Context.Items["MEMBER_NO"] = e.CommandArgument;

        if (e.CommandName == "Step0")
        {
            // 生活模型

            ControllerUtils.Transfer(this.Context, "~/App/Input/LivingMemberLivingForm.aspx", true);
        }

    }
    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {

    }

    protected void LinkButton_Command1(object sender, CommandEventArgs e)
    {
        // 传递控件参数
        Context.Items["MEMBER_NO"] = e.CommandArgument;

        if (e.CommandName == "Step1")
        {
            // 生活模型

            ControllerUtils.Transfer(this.Context, "~/App/Input/HealthMemberHealthForm.aspx", true);
        }

    }
}
